home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / telecomm / fnordadl / fn132src.zoo / cith / net.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-02  |  5.5 KB  |  157 lines

  1. /*
  2.  * net.h -- header file for the Citadel networker
  3.  *
  4.  * 91Apr29 AA    Renamed from ctdlnet.h, moved some stuff in here from ctdl.h
  5.  * 88Aug10 orc    removed old-style netmail structures
  6.  * 88Jul16 orc    removed old-style net file req/sendfile structures
  7.  * 88Jul12 orc    remote-command byte changed to avoid conflict with c-86
  8.  * 87Dec23 orc    Strip out NeedsProcessing() macros and handle on the fly
  9.  * 87Dec18 orc    Datastructure support for external autodialers
  10.  * 87Nov08 orc    network roomshare routing
  11.  * 87Jul24 orc    net password data structure support, autonet support
  12.  * 87May17 orc    extracted from ctdl.h
  13.  */
  14.  
  15. #ifndef _NET_H
  16. #define _NET_H
  17.  
  18. /*
  19.  * Network request codes
  20.  */
  21. #define HANGUP        0    /* Terminate networking         */
  22. #define    LOGIN        255    /* login to other side            */
  23. #define SEND_MAIL    1    /* Send mail                */
  24. #define SINGLE_FILE_REQUEST 2    /* Request one file; used only by C86    */
  25. #define FILE_REQUEST    3    /* Request a number of files (C86style)    */
  26. #define NET_ROOM    5    /* Send a shared room            */
  27. #define CHECK_MAIL    6    /* Check for recipient validity     */
  28. #define SEND_FILE    7    /* Send a file to another system    */
  29. #define ROLE_REVERSAL    201    /* Reverse roles            */
  30.  
  31. #define    COMPACTION    10    /* C-86 compaction option -- unused    */
  32. #define    OPTIONS        11    /* send options string            */
  33. #define    BATCH_SEND    12    /* ymodem batch files during networking    */
  34. #define    BATCH_REQUEST    13    /* ymodem batch files during networking    */
  35.  
  36. #define C86ITLCHG    100    /* Cit-86 version of OPTIONS        */
  37. #define C86NETPW    202    /* Cit-86 version of net passwords    */
  38.  
  39. #define ROUTE_SIG    '@'    /* mbroute[0]                */
  40. #define    ROUTE_ORIG    'O'    /* message originated here        */
  41. #define    ROUTE_LOCAL    'L'    /* message came from a local system    */
  42. #define    ROUTE_HUB    'H'    /* message came from a hub        */
  43.  
  44.  
  45. #define    N_SEQ    "\007\rE"    /* network mode is requested by a 7\rE    */
  46.                 /* sequence                */
  47. #define    N0_KEY    7            /* each sequence character    */
  48. #define    N1_KEY    '\r'
  49. #define    N2_KEY    'E'
  50. #define    N0_REP    (0xff & ~N0_KEY)    /* and each reply character    */
  51. #define    N1_REP    (0xff & ~N1_KEY)
  52. #define    N2_REP    (0xff & ~N2_KEY)
  53.  
  54. /*
  55.  * How message routing goes:
  56.  *
  57.  * all* netmessages are given a mbroute id.
  58.  * two classes of link:  local & hub.
  59.  * a hub link mails all messages (@O, @L, @H) and addresses them to @H
  60.  * a local link mails all @O and @H messages, addressing them to @L
  61.  *
  62.  *    [Local ->@L][-> Hub ->@H][-> Hub ->@L][-> Local]
  63.  *
  64.  */
  65.  
  66. #define ROUTEOK(x)    (((x)->mbroute[0]) == ROUTE_SIG)
  67. #define ROUTECHAR(x)    ((x)->mbroute[1])
  68. #define ROUTEFROM(x)    (&((x)->mbroute[2]))
  69.  
  70. #define    CALL_OK        0    /* callout went ok            */
  71. #define    NO_ID        1    /* couldn't exchange network ids    */
  72. #define    NOT_STABILISED    2    /* callout not stabilised        */
  73.  
  74. #define NO_ERROR    0    /* No error (ends transmission)     */
  75. #define NO_RECIPIENT    1    /* No recipient found            */
  76. #define BAD_FORM    2    /* Something's wrong            */
  77. #define UNKNOWN     99    /* Something's REALLY wrong (eek!)    */
  78.  
  79. #define    iDIRECT    0        /* mail directly to system        */
  80. #define    iALIAS    1        /* mail route found in netalias.sys    */
  81. #define    iHUBBED    2        /* mail forwarded to a #hub        */
  82. #define    iDOMAIN    3        /* mail passed to another domain    */
  83.  
  84. struct netroom {
  85.     long     NRlast;        /* Highest net message in this room    */
  86.     unsigned short NRgen;
  87.     short    NRidx;        /* roomTab[] position of shared room    */
  88.     short    NRhub;        /* backboned with the other system?    */
  89. };
  90.  
  91. /* Following #defines invented on our own */
  92. #define MINSHAREDROOMS    1
  93. #define MAXSHAREDROOMS    999
  94. #define SANESHAREDROOMS    20
  95.  
  96. /* Following #defines robbed from Hue, Jr.'s Cit-86 */
  97. #define NT_SIZE         (sizeof (*netTab) - PTR_SIZE)
  98. #define NB_SIZE         (sizeof (netBuf)  - PTR_SIZE)
  99. #define SR_BULK         (SHARED_ROOMS * sizeof (struct netroom))
  100. #define NT_TOTAL_SIZE   (NT_SIZE + SR_BULK)
  101. #define NB_TOTAL_SIZE   (NB_SIZE + SR_BULK)
  102.  
  103. struct netBuffer {
  104.     LABEL  netId;        /* Node id                */
  105.     LABEL  netName;        /* Node name                */
  106.     LABEL  myPasswd;        /* password I expect from other node    */
  107.     LABEL  herPasswd;        /* password other node expects from me    */
  108.     long   flags;        /* Flags                */
  109.     char   ld;            /* LD system? -- also poll count    */
  110.     char   dialer;        /* external dialer #            */
  111.     char   poll_day;        /* days to poll                */    
  112.     long   what_net;        /* which networks this node is in    */
  113.     char   baudCode;        /* Baud code for this node        */
  114.     char   access[40];        /* For alternative access        */
  115.     struct netroom *shared;
  116. };
  117.  
  118. #define sharing(i)     (netBuf.shared[i].NRidx >= 0 \
  119.     && readbit(roomTab[netBuf.shared[i].NRidx],SHARED) \
  120.     && roomTab[netBuf.shared[i].NRidx].rtgen == netBuf.shared[i].NRgen)
  121.  
  122. struct netTable {
  123.     short    ntnmhash;
  124.     short    ntidhash;
  125.     long    flags ;
  126.     char       ld;        /* LD system? -- also poll count    */
  127.     char       dialer;        /* external dialer #            */
  128.     char       poll_day;    /* days to poll                */    
  129.     long    what_net;    /* which networks this node is in    */
  130.     struct netroom *Tshared;
  131. };
  132.  
  133. /*
  134.  * network flags (formerly struct nflags)
  135.  */
  136. #define N_INUSE        0x0001L    /* Is this record even in use?        */
  137. #define MAILPENDING    0x0002L    /* Outgoing mail?            */
  138. #define FILEPENDING    0x0004L    /* Any file requests?            */
  139. #define REC_ONLY    0x0008L    /* can we call this L-D system?        */
  140. #define LD_RR        0x0010L    /* allow l-d role reversal?        */
  141. #define CIT86        0x0020L    /* is this a citadel-86?        */
  142.  
  143. /* The following #defines robbed (sorta) from Hue, Jr.'s Cit-86 */
  144. #define initnetBuf(x)    (x)->shared = (struct netroom *) xmalloc(SR_BULK)
  145. #define killnetBuf(x)    free((x)->shared)
  146.  
  147. struct poll_t {
  148.     short p_net;    /* net to poll */
  149.     short p_start;    /* minutes after midnight */
  150.     short p_end;    /* minutes after midnight */
  151.     short p_days;    /* days to poll this system: (xxxxxxxx xSFRWTMS) */
  152. } ;
  153.  
  154. #define    poll_today(x, d)    ((x) & (1<<(d)))
  155.  
  156. #endif /* _NET_H */
  157.